package com.elinkway.infinitemovies.ui.activity.play;

import android.annotation.TargetApi;
import android.os.Build;
import android.view.View;

import com.elinkway.infinitemovies.utils.LogUtils;

/**
 * 监听从4.0开始手机虚拟键的变化 
 * @author zhangshuo
 *
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class UiVisibilityChangeListener implements
		View.OnSystemUiVisibilityChangeListener {
	
	private PlayMediaController mController;
	
	@Override
	public void onSystemUiVisibilityChange(int visibility) {
		LogUtils.e("PlayMediaController", "!!!!!!onSystemUiVisibilityChange!!!!!!!!!");
		if (View.SYSTEM_UI_FLAG_VISIBLE == visibility) {
			// 当虚拟键展现时显示控制栏集顶部状态栏
			if (null != mController
					&& !mController.getmLockScreenBtn().isSelected()) {
				mController.showControllerLogic();
			}
		}
	}
	
	public void setmController(PlayMediaController mController) {
		this.mController = mController;
	}
	
}
